<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<style>
.table_list_tab{
border-bottom-color: rgb(223, 223, 223);
border-bottom: 1px solid #dfdfdf;
margin: 10px 0px 0px 0px;
padding-left: 15px;
}
</style>
<div id="clientInfoDiv">

	<form class="form-horizontal table-form" name="dirslog_form"  id="dirslog_form" action="dirClientOfExLog.action?countType=1" onsubmit="return searchFw(this)">
    	
    	<div class="table_list_tab">
			<ww:link name="clientofexlogTab" funcode="acl_log_client/dirClientOfExLog" caption="全部操作链接信息"  onclick="showAllDiv();"  href="javascript:;"></ww:link>
			<ww:link name="clientofloginexlogTab" funcode="acl_log_client/dirClientOfExLoginLog" caption="登录操作链接信息"  onclick="showLoginDiv();"  href="javascript:;"></ww:link>
		</div>
		
	    <input type="hidden" name="page.orderFlag" class="order-flag" value="<ww:property value='page.orderFlag'/>"> 
		<input type="hidden" name="page.orderString" class="order-string" value="<ww:property value='page.orderString'/>">
		<input type="hidden" name="page.pageSize" class="page-size" value="<ww:property value='page.pageSize'/>">
		<input type="hidden" name="page.totalPages" class="page-count" value="<ww:property value='page.totalPages'/>">
		<input type="hidden" name="page.currentPage" class="page-current" value="<ww:property value='page.currentPage'/>">
		<div class="table-header">
			<div class="table-search">
			<ul style="float: left;">
			<input type="radio" name="logType" class="day" value = "1" onclick="getSelfDatepicker(this)" checked="checked">按日查询
			<input type="radio" name="logType" class="month" value = "2" onclick="getSelfDatepicker(this)">按月查询
			<input type="radio" name="logType" class="jd" value = "3" onclick="getSelfDatepicker(this)">按季度查询
			<input type="radio" name="logType" class="year" value = "4" onclick="getSelfDatepicker(this)">按年查询
			</ul>

			<ul id="queryUl" style="margin-left: 20px">
				<li class="day" style="display:none;"><input class="input-small Wdate" id="countKey" name="countKey" readonly="true" type="text" 
			    onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})"> 
			  	</li>
				<li class="month" style="display:none;"><input class="input-small Wdate" id="countKey" name="countKey" readonly="true" type="text" 
			    onclick="WdatePicker({dateFmt:'yyyy-MM',maxDate:'%y-{%M-1}'})"> 
			  	</li>
			  	<li class="year" style="display:none;"><input class="input-small Wdate" id="countKey" name="countKey" readonly="true" type="text" 
			    onclick="WdatePicker({dateFmt:'yyyy',maxDate:'{%y-1}'})"> 
			  	</li>
			  	<li class="jd" style="display:none;"><input class="input-small Wdate" id="countKey" name="countKey" readonly="true" type="text" 
			    onclick="WdatePicker({dateFmt:'yyyy-M',isQuarter:true,disabledDates:['....-0[5-9]-..','....-1[0-2]-..'],startDate:'%y-01-01',maxDate:'%y-%M-%d'})">
			  	</li>
			</ul>
			<ul>
				<li id="simpleSearchBtn"><ww:button css="btn green" caption="查询" type="submit"></ww:button></li>
			</ul>
			</div>

		</div>
		<table class="table table-bordered" id="logEx" >
			<thead>
				<tr>
					<th width="60px">日期</th>
					<th width="60px">IE6</th>
					<th width="60px">IE7</th>
					<th width="60px">IE8</th>
					<th width="60px">IE9</th>
					<th width="60px">IE10</th>
					<th width="60px">IE11</th>
					<th width="60px">Chrome</th>
					<th width="60px">FrieFox</th>
					<th width="60px">其他</th>
					<th width="60px">查看图表详情</th>
				</tr>
			</thead>

		<tbody>
		  <ww:iterator value="page.results" id="data1" status="data1">
			<tr id="<ww:property value="#data1.index"/>">
				<ww:set name="exinfo" value="page.results[#data1.index]"/>
				<td class="text-center"><ww:property value="#exinfo.getDate()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe6()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe7()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe8()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe9()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe10()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getIe11()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getChrome()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getFirefox()"/></td>
				<td class="text-center"><ww:property value="#exinfo.getOther()"/></td>
				<td class="text-center"><a href="logExChart.action" rel="TJTB" target="cssTab" refresh="true" title="统计图表" onclick="accessAction(this)">点击查看图表信息</a></td>
			</tr>
			</ww:iterator>
		</tbody>
		</table>
		<div class="pagination"> <ww:property value="page.pageSplit"/></div>
	</form>

</div>


<script>
using('datepicker');

$(function(){
    $("#clientofloginexlogTab").attr("class","");
    $("#clientofexlogTab").attr("class","active");
	//默认选中按日选
	var inputs = $('input[type="radio"]');
	for(var i = 0; i < inputs.length; i++){
		if($(inputs[i]).attr('checked')){
			
			getSelfDatepicker(inputs[i]);
		}
	}
});

function showAllDiv(){
    $("#clientofloginexlogTab").attr("class","");
    $("#clientofexlogTab").attr("class","active");
    debugger;
    $('#dirslog_form').attr('action','dirClientOfExLog.action?countType=1');
}
function showLoginDiv(){
    $("#clientofloginexlogTab").attr("class","active");
    $("#clientofexlogTab").attr("class","");
    $('#dirslog_form').attr('action','dirClientOfExLoginLog.action?countType=2');
}

function searchFw(form){
    $css.tip("查询完毕！");
  return $action.query(form);
}

function getSelfDatepicker(selfClass){
	//把非当前选中的input值改为空
	
	var myClass = $(selfClass).attr('class');
	var myli = $("ul[id='queryUl']>li."+myClass);
	var otherLis = $("ul[id='queryUl']>li[class!="+myClass+']');
	for(var i = 0; i < otherLis.length; i++){
		var currentLi = otherLis[i];
		$(currentLi).css("display","none");
		$('input',currentLi).val("");
	}
	myli.css("display","inline");
}

//吧前端的数据获取发送到后台进行处理,传递给后台
function getTypes(){
	var types = '';
	var thead = $('#logEx').children()[0];
	var ths = $('th',thead);
	for(var i = 1; i < ths.length - 1; i++){
		if(i==(ths.length - 2)){
			types = types + "\'" +$(ths[i]).html() + "\'";
		}else{
			types = types + "\'" +$(ths[i]).html() + "\'" + ',';
		}
	}
	return types;
}

function getValues(thisId){
	var currentId = $(thisId).parent().parent().attr('id');
	var values = '';
	var currentTr = $('tr[id='+currentId+']',$('tbody','#logEx'));
	var tds = $('td',currentTr);
	for(var i = 1; i < tds.length - 1; i++){
		if(i==(tds.length - 2)){
			values = values + "\'" +$(tds[i]).html() + "\'";
		}else{
			values = values + "\'" +$(tds[i]).html() + "\'" + ',';
		}
	}
	return values;
}

function getDate(thisId){
	var currentId = $(thisId).parent().parent().attr('id');
	var currentTr = $('tr[id='+currentId+']',$('tbody','#logEx'));
	var tds = $('td',currentTr);
	var date = "\'" + $(tds.get(0)).html() + "\'";
	return date;
}

function accessAction(currentId){
	var types = getTypes();
	types = encodeURI(encodeURI(types));
	var values = getValues(currentId);
	var date = getDate(currentId);
	var newhref = $(currentId).attr('href') + "?exdate=" + date + "&exvalues=" + values + "&extypes=" + types;
	$(currentId).attr('href',newhref);
}

</script>
<script type="text/javascript">using('sw')
</script>
